#pip install pdf2docx
#pip install python-docx

from pdf2docx import Converter
def pdf_to_word(pdf_path, word_path):
    # 创建一个Converter对象
    cv = Converter(pdf_path)
    # 转换PDF文件的每一页
    cv.convert(word_path, start=0, end=None)
    # 完成转换并释放资源
    cv.close()
# 主函数
def main():
    pdf_path = 'D:\\files\\MySQL MyCAT读写分离配置.pdf'
    word_path = 'D:\\files\\temp\\MySQL MyCAT读写分离配置.docx'
    pdf_to_word(pdf_path, word_path)
if __name__ == '__main__':
    main()
